package com.jymj.entity.Analysis;

import com.jymj.entity.KeyValueEntity;
import lombok.Data;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;

/**
 * Created by ${lc} on 2021/8/17. 各乡镇未处理情况表
 */
@Data
public class WzgqkEntity {
    private String zhen;
    private String code;
    private Integer counts;//问题总数
    private Integer yzgcounts;//已整改问题数
    private Integer wzgcounts;//未整改问题数
    private BigDecimal zgl;//整改率
    private Integer zhenWsh;//镇级未审核数
    private Integer cuncount;//涉及村数量
    private List<KeyValueEntity> keyValueEntities;

    public BigDecimal getZgl() {
        if (getCounts() == null){
            return BigDecimal.valueOf(100);
        }else {
            return BigDecimal.valueOf(getYzgcounts())
                    .divide(BigDecimal.valueOf(getCounts()),3, RoundingMode.HALF_UP)
                    .multiply(BigDecimal.valueOf(100));
        }
    }
}